<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/mytag.jspf"%>

<!DOCTYPE html>
<html>
<head>
<base href="<%=basePath%>">
<title>用户</title>
<script type="text/javascript">
//初始化下拉框
$.ajax({
	url: "management/role/listRole",
	type:"POST",
	success:function(data){
		$(data).each(function(n){
            $("<option/>").html(this.name).val(this.roleId)
            .appendTo("#roleId");
        });
		$("#roleId").val('${t.roleId}');
	}
});
function deleteDay(_this,id){
	//alert("我的外层的是："+_this.parentNode.tagName);
	//alert("我的外层的id是："+_this.parentNode.id);
	//_this.parentNode.remove();
	if (id == "") {
		layer.msg("请选择删除项！！");
		return;
	}
	layer.confirm('是否删除？', function(index) {
		var url = "management/employee/holidaydelete/"+id;
		$.ajax({
			type : 'POST',
			url : url,
			dataType : 'json',
			success : function(data) {
				layer.msg(data.msg);
				if (data.success) {
					_this.parentNode.remove();
				}
			}
		});
	});
	
}
$(function() {
	$("#form").validate({
		rules : {
			"restDate" : {
				required : true,
				flutredate : true
			}
		},
		messages : {
			"restDate" : {
				required : "请选择添加的日期",
				flutredate : "请选择当前日期之后的日期" 
			}
		},
		errorPlacement: function(error, element){//错误信息显示位置
			if(element.attr("name")=="restDate"){
				error.css("left",$(element).width()+80);
				error.insertAfter(element);
			}else{
				error.insertAfter(element);
			}
		 }
	});
});
</script>
</head>
<body>
	<ol class="am-breadcrumb am-breadcrumb-slash am-padding" style="margin-bottom: 0px;">
		<li><a href="management/index">首页</a></li>
		<li><a href="management/employee/worksindex">作品库及休息日管理</a></li>
		<li class="am-active">员工休息日管理</li>
	</ol>
	<div class="am-g">
		<div class="am-u-md-12">
				<div class="am-tabs am-margin">
					<ul class="am-tabs-nav am-nav am-nav-tabs">
						<li class="am-active"><a href="javascript:void(0)">员工休息日</a></li>
					</ul>
					<div class="am-tabs-bd">
						<div class="am-tab-panel am-active">
							<div class="am-g">
								<div class="am-u-md-12">
									<form class="am-form am-form-horizontal">
									<input id="id" name="employeeId" type="hidden" value="${t.employeeId }">
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">账号</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="account" name="account" value="${t.account}" class="am-form-field am-input-sm" readonly>
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">角色</label>
										<div class="am-u-md-4 am-u-end">
											<select id="roleId" name="roleId" readonly>
												<option value="">请选择角色</option>
											</select>
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">所属门店</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="shopName" name="shopName" value="${t.shopName}" class="am-form-field am-input-sm" readonly>
											<input type="hidden" id="shopId" name="shopId" value="${t.shopId}" class="am-form-field am-input-sm">
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">姓名</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="name" name="name" value="${t.name}" class="am-form-field am-input-sm" readonly>
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">联系电话</label>
										<div class="am-u-md-4 am-u-end">
											<input type="text" id="phone" name="phone" value="${t.phone}" class="am-form-field am-input-sm" readonly>
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">性别</label>
										<div class="am-u-sm-4 am-u-end am-form-label am-text-left">
											<input type="radio" name="sex" <c:if test="${t.sex eq 'M'}"> checked="checked" </c:if> value="M" disabled="disabled"> 男
											<input type="radio" name="sex" <c:if test="${t.sex eq 'F'}"> checked="checked" </c:if> value="F"  disabled="disabled"> 女
										</div>
									</div>
									<div class="am-form-group">
										<label class="am-u-sm-2 am-form-label">月业绩目标</label>
										<div class="am-u-md-4 am-u-end">
											<input type="number" id="target" name="target" value="${t.target}" class="am-form-field am-input-sm" readonly="readonly">
										</div>
									</div>
									</form>
							
									<hr>
									<div class="am-u-lg-3 am-u-end">
										<form id="form" method="post" class="am-form" action="management/employee/holidaysave">
										      <input id="employeeId" name="employeeId" type="hidden" value="${t.employeeId }">
										      <input type="hidden" name="compId" id="compId" value="${t.compId }" class="am-form-field am-input-sm">
											    <div class="am-input-group">
												      <input id="restDate" name="restDate" type="text" class="am-form-field" placeholder="请选中需要添加的日期" data-am-datepicker readOnly>
												      <span class="am-input-group-btn">
												        <button class="am-btn am-btn-default" type="submit">添加</button>
												      </span>
											    </div>
									      </form>
									</div>
									<br>
									<div class="am-avg-sm-2 am-avg-md-4 am-avg-lg-6 am-margin gallery-list">
										<c:forEach var="holiday" items="${holidaylist}">
										<div style="background:#eee;margin:10px 10px 10px 10px " class="am-u-sm-2 am-u-end">
											<div style="text-align: center;line-height: 50px">
												<fmt:formatDate value='${holiday.restDate }' type="date" pattern="yyyy-MM-dd"/>
											</div>
											<div style="width:40px;height:20px;position:absolute;top:0;right:0;" onclick="deleteDay(this,'${holiday.holidayId}');">
												<span style="position:absolute;top:0;right:0;width: 0;height: 0;border-top: 50px solid #8fc320;border-left: 50px solid transparent;"></span>
												<span style="position:relative;margin-left:20px" class="am-icon-close"></span>
											</div>
										</div>
										</c:forEach>
									</div>								
							
								</div>
							</div>
						</div>
					</div>
					<div class="am-margin">
						<a href="management/employee/worksindex" class="am-btn am-btn-primary am-btn-xs"><span class="am-icon-times"></span> 返回</a>
					</div>
				</div>
		</div>
	</div>
</body>
</html>
